//
//  Referee.m
//  GuessingGame
//
//  Created by admin on 2019/7/30.
//  Copyright © 2019 猫爷爷的酱醋茶. All rights reserved.
//

#import "Referee.h"

@implementation Referee

-(void)RulingWithPlayer:(Player *)player andRobot:(Robot *)robot
{
    
    //先拿到玩家和机器人出的拳头
    Mora playerMora = player->_select;
    Mora robotMora = robot->_select;
    
    NSLog(@"\n\n我是[%@],这局我来做裁判！\n\n",_name);
    
    if (playerMora - robotMora == -2 || playerMora - robotMora == 1)
    {
        //玩家胜利
        NSLog(@"\n\n恭喜玩家「%@」获胜！\n\n",player->_name);
        //玩家获得一分
        player->_score++;
        
    }
    else if(playerMora == robotMora)
    {
        NSLog(@"\n\n平局");
    }else{
        //机器人获胜
        NSLog(@"\n\n恭喜机器人[%@]获胜！\n\n",robot->_name);
        //玩家获得一分
        robot->_score++;
    }
    
    //显示得分
    NSLog(@"\n\n------玩家「%@」得分：%d------\n------机器人「%@」得分：%d------\n\n",
          player->_name,
          player->_score,
          robot->_name,
          robot->_score
          );
    
}
@end
